package com.yijiankang.threaddemo.example.stableobject;

import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.Map;

@Slf4j
public class CollectionsTest {

    private static Map<Integer,Integer> map = Maps.newHashMap();

    static{
        map.put(1,2);
        map.put(2,3);
        map.put(4,5);
        //被unmodifiableMap 处理的map 不可被修改
        map = Collections.unmodifiableMap(map);
            
    }

    public static void main(String[] args) {
        map.put(1,3);//允许操作  但是会报一场
        log.info("{}",map);
    }
}
